//
//  PPLog.swift
//  HoneyChat
//
//  Created by 李建行 on 2022/10/27.
//

import Foundation
/// 普通打印
func PPLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
    #if DEBUG
    let message = messages.compactMap({ "\($0)" }).joined(separator: " ")
    print("\((file as NSString).lastPathComponent)[\(line)] - \(function): \(message)")
    #endif
}

/// 生命周期打印
func PPLifeLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "MM-dd HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    print("💊💊💊Life:[\(dateStr)],\(function),_______\(messages)")
#endif
}

/// 生命周期打印
func PPCallLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "MM-dd HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    print("🐽🐽🐽\(dateStr)_______\(messages)")
#endif
}
/// 生命周期打印
func PPWarningLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    print("🟡🟡🟡Warning_______\(messages)")
#endif
}

/// DataBase专用打印
func PPDBLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "MM-dd HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    print("🐍🐍🐍DB:[\(dateStr)],\(function) \n\(messages)")
#endif
}

/// IM专用打印
func PPIMLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "MM-dd HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    print("🐝🐝🐝IM:[\(dateStr)] \n\(messages)")
#endif
}

/// 网络请求专属打印
func PPNetLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    Swift.print("🟢🟢🟢\(dateStr) \(messages)", separator: " ", terminator: "\n")
#endif
}

func PPErrorLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    print("❌❌❌Error_______\(messages)")
#endif
}


func PPPayLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    print("🐶🐶🐶Pay```````\(messages)")
#endif
}
/// 生命周期打印
func PPWebLog(_ messages: Any..., file: String = #file, function: String = #function, colunm: Int = #column, line: Int = #line) {
#if DEBUG
    let formatter = DateFormatter()
    formatter.dateFormat = "HH:mm:ss"
    let dateStr = formatter.string(from: Date())
    print("🦊🦊🦊Web:[\(dateStr)]_______\(messages)")
#endif
}
